LIBRARY IEEE;
USE IEEE.STD_LOGIC_1164.ALL;
USE IEEE.STD_LOGIC_UNSIGNED.ALL;

ENTITY sec_decoder IS
    PORT (
        OP : IN STD_LOGIC_VECTOR(2 DOWNTO 0);
        S : OUT STD_LOGIC_VECTOR(3 DOWNTO 0)
    );
END sec_decoder;

ARCHITECTURE behav OF sec_decoder IS
BEGIN
    PROCESS(OP)
    BEGIN
        CASE OP IS
            WHEN "000" => S <= "0000"; --or
            WHEN "001" => S <= "0001"; --and
            WHEN "010" => S <= "0010"; --+
            WHEN "011" => S <= "0011"; -- -
            WHEN "100" => S <= "0100"; -- 逻辑<<
            WHEN "101" => S <= "0101"; -- 逻辑>>
            WHEN "110" => S <= "0110"; -- 算数<<
				WHEN "111" => S <= "0111"; -- slt
            WHEN OTHERS => S <= "0000"; -- 处理未定义的操作码情况
        END CASE;
    END PROCESS;
END behav;
